
<div id="wrap">
	<h1>选修课双B及单科达B率统计</h1>
	<!--div class="statisticsNav">
		< div class="school subject">
			<h1>学校</h1>
			<ul>
				<?php 
					if(!empty($schoolList)):
		               	foreach($schoolList AS $school_id=>$schoolB):
				?>
					<?php 
						if( !empty($rSchoolID) ){
					?>
						<li schoolId="<?php echo $school_id; ?>" class="on"><?php echo $schoolB; ?></li>
					<?php 
						}else{
					?>
						<li schoolId="<?php echo $school_id; ?>" class="<?php echo $school_id==$rSchoolID ? 'on':'';?>"><?php echo $schoolB; ?></li>
					<?php 
						}
					?>
				<?php
						endforeach; 
					endif;
				?>
			</ul>
		</div>
		<p style="clear:both;"></p>
	</div-->
	<div class="clearfix">
		<div id="statisticsChart"></div>
	</div>
	<div class="clearfix">
            <form action="/st/default/doubleb/" method="get">
                <input type="hidden" name="export_excel" value="1"/>
                <input type="hidden" name="exam_id" value="<?php echo $rExamID?>"/>
                <?php if($rSchoolID):?>
                <input type="hidden" name="school_id" value="<?php echo $rSchoolID?>"/>
                <?php  endif;?>
                <input type="submit" name="submit" value="导出" class="b_a_n border_3 back_bgfb w80 height32 fontc_FFF fonts_12 cursor fr mr20 mt10" />
            </form>
    </div>
	<div id="statisticsTABLE">
        
		<table class="fontc_666 height32" align="center" valign="middle" border="0" cellpadding="0" cellspacing="0" width="100%">
			<thead class=" fontc_999" bgColor="#4e98bd" style="color:#fff;">
				<tr height="38">
					<th width="150" align="center" rowspan="2" valign="middle" class="border_d"><span style="padding:0 5px;">学校</span></th>
					<th width="150" align="center" rowspan="2" valign="middle" class="border_d"><span style="padding:0 5px;">人数</span></th>
					<th width="" align="center" colspan="<?php echo count($subjectList);?>" valign="middle" class="border_d"><span style="padding:0 5px;">各科人数</span></th>
					<th width="" align="center" colspan="2" valign="middle" class="border_d"><span style="padding:0 5px;">达2B</span></th>
					<th width="" align="center" colspan="<?php echo count($subjectList)*2;?>" valign="middle" class="border_d"><span style="padding:0 5px;">各科达B</span></th>
				</tr>
				<tr height="38">
					<?php if (!empty($subjectList)):?>				
					<?php foreach($subjectList AS $k=>$v):?>
                        <th width="150" align="center"  valign="middle" class="border_d"><span style="padding:0 5px;">选<?php echo $v;?></span></th>
                    <?php endforeach;?>
                    <?php else:?>
                    <th width="150" align="center"  valign="middle" class="border_d"><span style="padding:0 5px;"></span></th>
                    <?php endif;?>
                    <th width="150" align="center"  valign="middle" class="border_d"><span style="padding:0 5px;">2B人数</span></th>
					<th width="150" align="center"  valign="middle" class="border_d"><span style="padding:0 5px;">2B率</span></th>
					<?php if (!empty($subjectList)):?>	
					<?php foreach($subjectList AS $k=>$v):?>
                        <th width="150" align="center"  valign="middle" class="border_d"><span style="padding:0 5px;"><?php echo $v;?></span></th>
						<th width="150" align="center"  valign="middle" class="border_d"><span style="padding:0 5px;"><?php echo $v;?>B率</span></th>
                    <?php endforeach;?>
                    <?php else:?>
                    <th width="150" align="center"  valign="middle" class="border_d"><span style="padding:0 5px;"></span></th>
                    <?php endif;?>
				</tr>
			</thead>
			
			<tbody style="background:#fff;">
				<?php 
					$school_data = array();
					if(!empty($schoolData)):
		               	foreach($schoolData AS $school_id=>$schoolB):
                        $school_data[$school_id]['name'] = isset($schoolList[$school_id])?$schoolList[$school_id]:'';
				?>
					<tr height="38">
						<td align="center" class="border_d" valign="middle" ><span style="padding:0 5px;"><?php echo isset($schoolList[$school_id])?$schoolList[$school_id]:''?></span></td>
						<?php $pepole_num = isset($schoolB['studentNum'])?$schoolB['studentNum']:0;?>
						<td align="center" class="border_d" valign="middle" ><span style="padding:0 5px;"><?php echo $pepole_num;?></span></td>
						<?php foreach($subjectList AS $k=>$v):?> 
							<td align="center" class="border_d" valign="middle" ><span style="padding:0 5px;"><?php echo isset($schoolB['subjectStudentNum'][$k])?$schoolB['subjectStudentNum'][$k]:0;?></span></td>
						<?php endforeach;?> 
						<?php $totalB = isset($schoolB['subjectStudentDBNum'])?$schoolB['subjectStudentDBNum']:'0';?>
						<td align="center" class="border_d" valign="middle" ><span style="padding:0 5px;"><?php echo $totalB;?></span></td>
						<td align="center" class="border_d" valign="middle" ><span style="padding:0 5px;"><?php echo $pepole_num?round($totalB*100/$pepole_num,2):0;?>%</span></td>
						<?php $school_data[$school_id]['data'][] = $pepole_num?round($totalB*100/$pepole_num,2):0;?>
						<?php foreach($subjectList AS $k=>$v):?> 
							<?php 
								$subject_total_num = isset($schoolB['subjectStudentNum'][$k])?$schoolB['subjectStudentNum'][$k]:0;
								$subject_totalB_num = isset($schoolB['subjectStudentBNum'][$k])?$schoolB['subjectStudentBNum'][$k]:0;
							?>  
							<td align="center" class="border_d" valign="middle" ><span style="padding:0 5px;"><?php echo $subject_totalB_num;?></span></td>
							<td align="center" class="border_d" valign="middle" ><span style="padding:0 5px;"><?php echo $subject_total_num?round($subject_totalB_num*100/$subject_total_num,2):0;?>%</span></td>
							<?php 
								$school_data[$school_id]['data'][] = $subject_total_num?round($subject_totalB_num*100/$subject_total_num,2):0;
							?> 
						<?php endforeach;?> 
					</tr>	
				<?php 
						endforeach; 
					endif;
				?>
			</tbody>
		</table>
	</div>
</div>
<?php  
	array_unshift($subjectList, '双B');
	foreach($subjectList AS $k=>$v){
		$subject_name_list[] = $v."达B率";
	}
    sort($school_data);
	$subject_name_list = json_encode($subject_name_list);
	$school_data_list = json_encode($school_data);  
?>
<script>
	$(function () {
    $('#statisticsChart').highcharts({
        chart: {
            type: 'column'
        },
        title: {
            text: ''
        },
        subtitle: {
            text: ''
        },
        xAxis: {
            categories: <?php echo $subject_name_list; ?>
        },
        yAxis: {
            min: 0,
            title: {
                text: '达B率'
            }
        },
        tooltip: {
            headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
            pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
                '<td style="padding:0"><b>{point.y:.1f} %</b></td></tr>',
            footerFormat: '</table>',
            shared: true,
            useHTML: true
        },
        plotOptions: {
            column: {
                pointPadding: 0.2,
                borderWidth: 0
            }
        },
        series: <?php echo $school_data_list?>
    });
});
	/*$(function(){
		var xAxis =<?php echo $subject_name_list; ?>,
			data = {
				dataNum : <?php echo $school_data_list;?>, //比率
				categories : <?php echo $subject_name_list; ?>,  //科目
				lable : "达B率",
				unit : "%" //单位
			};
		YUEchart.reachChart( $("#statisticsChart"),data );
		$( ".subject li" ).click(function(){
			var school_id=$(this).attr("schoolid"),
				postData = {
						exam_id : <?php echo $rExamID;?>,
						school_id : school_id,
						type : "ajax"
					}
			$(this).addClass("on").siblings().removeClass("on");
			$.post('/st/default/doubleb',postData,function(result){
				var result = $.parseJSON(result );
				var data = {
						dataNum : result, //比率
						categories : xAxis,  //科目
						lable : "达B率",
						unit : "%" //单位
					};
				YUEchart.reachChart( $("#statisticsChart"),data );
					
			})
		})
	})*/
</script>